package com.yty.demo._4_oop.implements_demo;

/**
 * @author: yangtaoyao
 * @time: 2020/1/10 10:07
 * @description: 接口应用举例 1
 * 继承抽象类后通过实现接口可不修改抽象类的同时获取更多拓展方法
 */
public class SCTeacher extends Person implements Cooking,Sing{

    public SCTeacher(int age, String name, int sex) {
        super(age, name, sex);
    }

    @Override
    void showInfo() {
        System.out.println("SCTeacher.showInfo()");
    }


    @Override
    public void fry() {
        System.out.println("SCTeacher.fry()");
    }

    @Override
    public void singing() {
        System.out.println("SCTeacher.singing()");
    }
}

abstract class Person{
    int age;
    String name;
    int sex;
    abstract void showInfo();

    public Person(int age, String name, int sex) {
        this.age = age;
        this.name = name;
        this.sex = sex;
    }
}

interface Cooking{
    void fry();
}

interface Sing{
    void singing();
}